<?php

class Support extends Doctrine_Record {

    public function setTableDefinition() {
        $this->hasColumn('company_gear_id', 'integer', 20);
        $this->hasColumn('it_gear_problem', 'string', 1000);
        $this->hasColumn('client', 'string', 255);
        $this->hasColumn('email', 'string', 255);
        $this->hasColumn('phone', 'string', 255);
        $this->hasColumn('set_job_user_id', 'integer', 20);
        $this->hasColumn('manage_job_user_id', 'integer', 20);
        $this->hasColumn('creater_job_user_id', 'integer', 20);
        $this->hasColumn('picture', 'string', 255);
        $this->hasColumn('meta_info', 'string', 1000);
    }
 
    public function setUp() {
        $this->actAs('Timestampable');
        $this->hasOne('Company_gear', array(
            'local' => 'company_gear_id',
            'foreign' => 'id',
            'onDelete' => 'CASCADE'
                )
        );
        $this->hasMany('Comment as Comments', array(
            'local' => 'id',
            'foreign' => 'support_id'
                )
        );
        $this->hasOne('User', array(
            'local' => 'set_job_user_id',
            'foreign' => 'id',
            'onDelete' => 'CASCADE'
                )
        );
        $this->hasOne('User', array(
            'local' => 'manage_job_user_id',
            'foreign' => 'id',
            'onDelete' => 'CASCADE'
                )
        );
        $this->hasOne('User', array(
            'local' => 'creater_job_user_id',
            'foreign' => 'id',
            'onDelete' => 'CASCADE'
                )
        );
        $this->hasMany('Act_computer as Act_computers', array(
            'local' => 'id',
            'foreign' => 'support_id'
                )
        );
    }

}

